/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package teste_banco;

import dao.*;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author 07200765
 */
public class test_conexao {
    private static Conexao conex;

    public test_conexao() throws SQLException {     
    }

    @BeforeClass    
    public static void setUpClass() throws Exception {
        conex = new Conexao();
    }

    @AfterClass
    public static void tearDownClass() throws Exception {

    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    @Test
    public void testConectarOk() throws SQLException {
        bancoCasehd bc = new bancoCasehd();
        assertEquals(true, conex.conectar( bc.getUrl(), bc.getUsername(), bc.getPassword() ));
    }

    @Test
    public void testConectarFalha(){
        boolean res = false;
        try {
            res = conex.conectar("", "", "");
            assertEquals(false, res);
        } catch (SQLException ex) {
            assertEquals(false, res);
            //Logger.getLogger(test_conexao.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}